// 辅料计划
import request from '@/axios'
import { NeedPlanType } from '@/api/dispatch/needplan/types'

export const getNeedPlanListApi = (params: any) => {
  return request.get<NeedPlanType[]>({ url: '/dispatch/need/plan', params })
}

export const addNeedPlanApi = (data: any) => {
  return request.post({ url: '/dispatch/need/plan', data })
}

export const putNeedPlanApi = (data: any) => {
  return request.put({ url: `/dispatch/need/plan/${data.id}`, data })
}

export const deleteNeedPlanApi = (ids: string[] | number[]) => {
  return request.delete({ url: '/dispatch/need/plan', data: ids })
}

export const triggerNeedPlanApi = (data_id: number, method: string) => {
  return request.put({ url: `/dispatch/need/plan/${data_id}/trigger`, data: { method } })
}

export const recognizeNeedApi = (params: any) => {
  return request.get({ url: '/dispatch/need', params })
}
